package com.gitee.jjnnzb.designpatterninspring.business.sensitive_word.handler.impl;

import com.gitee.jjnnzb.designpatterninspring.business.sensitive_word.handler.SensitiveWordFilter;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author Jjn
 * @since 2023/8/11 15:18
 */
@Service
@Order
public class RegexExpressionFilterImpl implements SensitiveWordFilter {
    
    @Override
    public void filter(Map<String, Object> map) {
        String content = (String) map.get("content");
        String replaced = content.replace("呵呵|傻子", "***");
        map.put("content", replaced);
    }
}
